<?php

class DefaultTemplate implements Template {

	private array $data = [];

	public function load(array $data) {
		$this->data = array_merge($this->data, $data);
	}

	public function insert(array $entry) {
		$this->data[] = $entry;
	}

	protected function generateEntry(array $entry): string {
		return json_encode($entry);
	}

	public function generate(): string {
		$generated = "";
		foreach ($this->data as $entry)
			$generated .= $this->generateEntry($entry);
		return $generated;
	}

}
